package com.bbva.dao;

import javax.persistence.EntityManager;

import com.bbva.model.User;

public class UserDAO {
	
	private EntityManager entityManager;

	public void persist(User user) {
		entityManager.getTransaction().begin();
		entityManager.persist(user);
		entityManager.getTransaction().commit();
	}
	
	public User getById(String id) {
		return entityManager.find(User.class, id);
	}

	public EntityManager getEntityManager() {
		return entityManager;
	}

	public void setEntityManager(EntityManager entityManager) {
		this.entityManager = entityManager;
	}

}
